package com.inossem.warehousestorage_inossem.request.inStorage.chuangyou;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageAllocatingOverviewBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageShoppingOverviewBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * TODO
 *
 * @author 王斯宇
 * @time on 2018/3/31 10:42
 * @email siyu.wang@inossem.com
 */
public class CYInStorageShoppingOverviewRequest extends Request {
    private static final String STOCK_INPUT_ID = "stock_input_id";//调拨单号

    public static String request(Context context, String stock_input_id, GsonBeanListener gsonBeanListener) {
        String tag;
        Map<String, String> params = new HashMap<>();
        params.put(STOCK_INPUT_ID, stock_input_id);
        String url = RequestManage.getUrl(context, RequestConstant.CY_URL_IN_STORAGE_SHOPPING_OVERVIEW + "/" + stock_input_id);
        tag = RequestManage.getHttpsGetWithLoading(context, url, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                CYInStorageShoppingOverviewBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), CYInStorageShoppingOverviewBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }
}
